package com.SmsModule.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import util.ConnectDB;
import util.UtilDAO;

import com.SmsModule.bean.TbSmsReceive;
import com.SmsModule.bean.TbSmsSend;

/**
 * 短信接收模块操作DAO
 * jhc
 * 2011-1-27下午01:52:05
 */
public class TbSmsReceiveDAO {
	private Connection conn = null;
	private PreparedStatement pt = null;
	private ResultSet rs = null;
	private boolean flag = false;
	private String sql = "";
	
	private  TbSmsReceive tbsmsreceive=null;
	private  List<TbSmsReceive> TbSmsReceiveList=null;
	
	/**
	 * 查询短信接收列表
	 * jhc
	 * 2011-1-27 下午01:55:27
	 */
	public List<TbSmsReceive> getTbSmsReceiveAll(String tableName,String tiaojian,String order){
		try {
			conn = ConnectDB.getSqlServerConnection();
			sql = UtilDAO.getList(tableName,order, tiaojian);
			pt = conn.prepareStatement(sql);
			rs = pt.executeQuery();
			
			while(rs.next())
			{
						if(TbSmsReceiveList==null)
						{
						  TbSmsReceiveList = new ArrayList<TbSmsReceive>();
						}
						tbsmsreceive = new TbSmsReceive();
						tbsmsreceive.setReceiveId(rs.getInt("receiveId"));
						tbsmsreceive.setReceiveContent(rs.getString("receiveContent"));
						tbsmsreceive.setSendPhone(rs.getString("sendPhone"));
						tbsmsreceive.setOrgNum(rs.getString("orgNum"));
						tbsmsreceive.setReceiveType(rs.getInt("receiveType"));
						tbsmsreceive.setReceiveTime(rs.getString("receiveTime"));
						TbSmsReceiveList.add(tbsmsreceive);
					
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}finally {
           ConnectDB.closeSqlConnection();
        }
		return TbSmsReceiveList;
	}
	/**
	 * 多项删除
	 * jhc
	 * 2011-1-27 下午02:30:38
	 */
	public boolean del(String tableName,String keyId,String idList){
		boolean bo = UtilDAO.del(tableName, keyId, idList);
		return bo ;
	}
	public static void main(String[] args) {
		
	}
}
